using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using Ras2ClassLib.Common.Data;

namespace Ras2ClassLib
{
	public class LagDoc : BaseDocument
	{
		#region Public functions
		public LagCollection GetAllLag()
		{
			String strSQL = "select * from Lag INNER JOIN Flytjandi fl ON Lag.FlytjandiID = fl.FlytjandiID";
			return base.LoadCollection<LagCollection, Lag>(strSQL);
		}

		public LagCollection GetAllFlyt(int nID)
		{
            String strSQL = String.Format("select * from Lag INNER JOIN Flytjandi fl ON Lag.FlytjandiID = fl.FlytjandiID WHERE fl.FlytjandiID={0}", nID);
			return base.LoadCollection<LagCollection, Lag>(strSQL);
		}

		public Lag GetLag(int nID)
		{
            String strSQL = String.Format("SELECT * FROM Lag  lg, Flytjandi  fl WHERE fl.FlytjandiID = lg.FlytjandiID AND lg.LagID={0}", nID);
			return base.LoadItem<Lag>(strSQL);
		}

        public void UpdateLag(Lag song)
        {
            base.UpdateData(song.GetTable());
        }

        public void AddLag(Lag song)
        {
            base.AddData(song.GetTable());
        }
		#endregion
	}
}
